package com.atguigu.tingshu.album.rpc;

import com.atguigu.tingshu.album.service.AlbumInfoService;
import com.atguigu.tingshu.album.service.BaseCategoryService;
import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.album.AlbumInfo;
import com.atguigu.tingshu.model.album.BaseCategory3;
import com.atguigu.tingshu.vo.album.AlbumStatVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/album/albumInfo/inner")
public class AlbumrbcContoller  {

    @Autowired
    AlbumInfoService albumInfoService;

    @Autowired
    BaseCategoryService baseCategoryService;

    //远程调用专辑的基本信息
    @GetMapping("/getAlbumInfo/{albumId}")
    Result<AlbumInfo> getAlbumInforbc(@PathVariable(value = "albumId") Long albumId){
        AlbumInfo albumInfo = albumInfoService.getAlbumInforbc(albumId);
        return Result.ok(albumInfo);
    }
    //远程调用专辑的统计信息
    @GetMapping("/getAlbumInfoStartByIdrpc/{albumId}")
    Result<AlbumStatVo> getAlbumInfoStartByIdrpc(@PathVariable(value = "albumId") Long albumId){
        AlbumStatVo albumStatVo = albumInfoService.getAlbumInfoStartByIdrpc(albumId);
        return Result.ok(albumStatVo);
    }
    @Operation(summary = "根据一级分类id获取该一级分类下的前七个三级分类对象")
    @GetMapping("/getCategory3EntityByC1Id/{c1Id}")
    Result<List<BaseCategory3>> getCategory3EntityByC1Id(@PathVariable Long c1Id){
        List<BaseCategory3> topBaseCategory3 = baseCategoryService.findTopBaseCategory3(c1Id);
        return Result.ok(topBaseCategory3);
    }
}
